﻿<UserControl x:Class="MissedMemo.MeatAndCheeseDisc.OrderEntry.viewOrderEditPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dropShadow="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:local="clr-namespace:MissedMemo.MeatAndCheeseDisc.OrderEntry"
    Height="540" Width="400">

    <UserControl.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="resCommonStyles.xaml" />
                <ResourceDictionary Source="resTabControlTemplate.xaml" />
            </ResourceDictionary.MergedDictionaries>
            
            <Style x:Key="OrderEditPanelStyle" TargetType="Border" >
                <Setter Property="Background" Value="{StaticResource brushEditPanel}" />
                <Setter Property="BorderBrush" Value="{StaticResource brushEditPanelBorder}" />
                <Setter Property="BorderThickness" Value="2" />
                <Setter Property="Margin" Value="2" />
                <Setter Property="CornerRadius" Value="4" />
            </Style>
            
            <local:OrderStateToViewEnabledConverter x:Key="OrderStateToViewEnabledConverter" />

        </ResourceDictionary>
    </UserControl.Resources>

    
    <!-- performant drop shadow (recommended in place of bitmap effects - may no longer be needed with .Net 3.5 RTM)-->
    <dropShadow:SystemDropShadowChrome Margin="5,5,6,8" Color="{StaticResource colorDropShadow}"
                                       CornerRadius="{Binding CornerRadius, ElementName=PanelBorder}" >
        
        <Border Name="PanelBorder" Style="{StaticResource OrderEditPanelStyle}" >

            <Grid Margin="12" >

                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                
                <TabControl Name="tabControl" Grid.Row="0" Grid.RowSpan="2" >
                    <TabItem Header="{Binding NowServingNumber, Converter={StaticResource FormattedTextConverter}, ConverterParameter='Order# {0}'}"
                             IsSelected="True" MinHeight="24" MinWidth="60" >
                        <local:viewOrderDetails x:Name="orderDetails" Width="auto" Height="auto" FontWeight="Normal"
                               IsEnabled="{Binding ProcessingState, Converter={StaticResource OrderStateToViewEnabledConverter}}" />
                    </TabItem>
                    <TabItem Header="{Binding Customer.Name}"  MinHeight="24" MinWidth="60" >
                        <local:viewCustomerDetails x:Name="customerDetails" Width="auto" Height="auto" FontWeight="Normal"
                               IsEnabled="{Binding ProcessingState, Converter={StaticResource OrderStateToViewEnabledConverter}}" />
                    </TabItem>
                </TabControl>
                
                <local:DeliveryOptionsSelector Grid.Row="0" HorizontalAlignment="Right" Margin="14,-2"
                       IsEnabled="{Binding ProcessingState, Converter={StaticResource OrderStateToViewEnabledConverter}}" />
                
                <DockPanel Grid.Row="2" Margin="0,10,0,0" Style="{StaticResource OKCancelButtonPanelStyle}" >
                    <Button Content="Cancel" Click="OnDone" Margin="3,0,0,0" />
                    <Button Content="Save Changes" Click="OnDone" Command="ApplicationCommands.Save" IsEnabled="{Binding UnsavedChanges}"/>
                </DockPanel>

            </Grid>
            
        </Border>
    </dropShadow:SystemDropShadowChrome>

</UserControl>
